--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_haniyasushin_keiki = General:new(extension, "hy_haniyasushin_keiki", "chi_k", 4, 4, General.Female)
    local isolated_god = fk.CreateSkill {
        name = "isolated_god",
    }
    isolated_god:addEffect("distance", {
        correct_func = function(self, from, to)
            if from:hasSkill(self) then
                return 1
            end
            if to:hasSkill(self) then
                return 1
            end
        end,
    })
    local idol_army = fk.CreateSkill {
        name = "idol_army",
    }
    idol_army:addEffect(fk.PreCardUse, {
        can_trigger = function(self, event, target, player, data)
            if not player:hasSkill(self) then
                return false
            end
            return #HY.GetEmptyEquipSlots(player) <= 2 and target == player
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            data.disresponsiveList = room:getOtherPlayers(player)
        end,
    })
    idol_army:addEffect(fk.AfterCardsMove, {
        can_trigger = function(self, event, target, player, data)
            if not player:hasSkill(self) then
                return false
            end
            return #HY.GetEmptyEquipSlots(player) <= 1 and player.phase ~= Player.NotActive and table.any(data, function(move)
                return move.to == player and move.toArea == Player.Hand and move.skillName ~= idol_army.name
            end) and #player:getCardIds("h") <= player:getMaxCards()
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:drawCards(player, 1, idol_army.name)
        end,
    })
    idol_army:addEffect("maxcards", {
        correct_func = function(self, player)
            if player:hasSkill(self) and #HY.GetEmptyEquipSlots(player) <= 3 then
                return 3
            end
        end
    })
    idol_army:addEffect("targetmod", {
        bypass_distances = function(self, player, skill, card, to)
            if player:hasSkill(self) and #HY.GetEmptyEquipSlots(player) <= 2 then
                return true
            end
        end
    })
    local create_shape = fk.CreateSkill {
        name = "create_shape",
    }
    create_shape:addEffect("active", {
        target_num = 0,
        card_num = 1,
        target_filter = Util.FalseFunc,
        card_filter = function(self, player, to_select, selected)
            return #selected == 0 and
                ((Fk:getCardById(to_select).type == Card.TypeBasic and #Self:getAvailableEquipSlots(Card.SubtypeWeapon) > 0) or (Fk:getCardById(to_select).type == Card.TypeTrick and #Self:getAvailableEquipSlots(Card.SubtypeArmor) > 0)) and
                table.contains(Self:getCardIds("he"), to_select)
        end,
        can_use = function(self, player)
            return player:usedSkillTimes(create_shape.name, Player.HistoryPhase) < 1
        end,
        prompt = function(self, selected_cards, selected_targets)
            return "create_shape_prompt"
        end,
        on_use = function(self, room, cardUseEvent)
            local player = cardUseEvent.from
            local card = Fk:getCardById(cardUseEvent.cards[1])
            room:recastCard(cardUseEvent.cards, player, create_shape.name)
            local mark = player:getTableMark("create_shape")
            local result
            if card.type == Card.TypeBasic then
                result = Player.WeaponSlot
            else
                result = Player.ArmorSlot
            end
            table.insert(mark, result)
            room:setPlayerMark(player, "create_shape", mark)
            room:abortPlayerArea(player, result)
        end,
    })
    create_shape:addEffect(fk.CardUsing, {
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(self) and table.contains(player.sealedSlots, Player.WeaponSlot) and data.card.type == Card.TypeTrick and data.from and data.from == player
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:drawCards(player, 1, create_shape.name)
        end,
    })
    create_shape:addEffect(fk.EventPhaseStart, {
        can_refresh = function(self, event, target, player, data)
            return #player:getTableMark("create_shape") > 0 and target == player and target.phase == Player.Play
        end,
        on_refresh = function(self, event, target, player, data)
            local room = player.room
            room:resumePlayerArea(player, player:getTableMark("create_shape"))
            room:setPlayerMark(player, "create_shape", 0)
        end,
    })
    create_shape:addEffect("targetmod", {
        bypass_times = function(self, player, skill, scope, card, to)
            if player:hasSkill(self) and table.contains(player.sealedSlots, Player.ArmorSlot) and card.type == Card.TypeBasic then
                return true
            end
        end,
    })
    local god_creation = fk.CreateSkill {
        name = "god_creation",
        tags = {
            Skill.Lord
        },
    }
    god_creation:addEffect(fk.GameStart, {
        can_trigger = function(self, event, target, player, data)
            local room = player.room
            return player:hasSkill(self) and player:hasEmptyEquipSlot(Card.SubtypeTreasure) and
                room:getCardArea(U.prepareDeriveCards(room, { { "idol_bodyguard", Card.Spade, 1 } }, "god_creation_derivecards")[1]) == Card.Void
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:moveCardIntoEquip(player, U.prepareDeriveCards(room, { { "idol_bodyguard", Card.Spade, 1 } }, "god_creation_derivecards"), god_creation.name)
        end,
    })
    extension:loadSkillSkels { isolated_god, idol_army, create_shape, god_creation }
    hy_haniyasushin_keiki:addSkill("isolated_god")
    hy_haniyasushin_keiki:addSkill("idol_army")
    hy_haniyasushin_keiki:addSkill("create_shape")
    hy_haniyasushin_keiki:addSkill("god_creation")
    Fk:loadTranslationTable {
        ["hy_haniyasushin_keiki"] = "埴安神袿姬",
        ["#hy_haniyasushin_keiki"] = "只身立教",
        ["designer:hy_haniyasushin_keiki"] = "黑曜人形",
        ["illustrator:hy_haniyasushin_keiki"] = "へがた",
        ["cv:hy_haniyasushin_keiki"] = "",

        ["isolated_god"] = "孤神",
        [":isolated_god"] = "其他角色与你的距离+1，你与其他角色的距离+1。",

        ["idol_army"] = "偶军",
        [":idol_army"] = "若你装备区的空装备栏数：不大于3，你的手牌上限+3；不大于2，你使用牌无距离限制且不可被其他角色响应；不大于1，你于回合内不以此法获得手牌后，若你的手牌数不大于手牌上限，摸一张牌。",

        ["create_shape"] = "造形",
        [":create_shape"] = "出牌阶段限一次，你可以重铸一张基本牌/锦囊牌并<a href = 'temp_operation'>临时</a>废除你的武器栏/防具栏直到你的下个出牌阶段开始。若你的武器栏/防具栏被废除，你使用锦囊牌时摸一张牌/使用基本牌无次数限制。",
        ["create_shape_prompt"] = "造形：你可以重铸一张基本牌或锦囊牌",

        ["god_creation"] = "神创",
        [":god_creation"] = "主公技，游戏开始时，将<a href = 'idol_bodyguard_description'>【偶像卫队】</a>置入你的装备区。",
        ["idol_bodyguard_description"] = "【偶像卫队】：宝物牌，黑桃，点数1。结束阶段，你用【影】将手牌补至手牌上限；准备阶段，你弃置所有【影】。",
    }
end
